/*
 * @Author: your name
 * @Date: 2022-01-01 16:51:48
 * @LastEditTime: 2022-01-01 19:05:56
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \App\src\store\productOrder\productOrder.js
 */
import { post, get } from '@/http/axios'
export default {
    namespaced: true,
    state: {
        //   订单信息
        productOrderData: [],
        orderDataById:{},
        orderData_Tag:[],
    },
    mutations: {
        SET_PRODUCTORDER(state, data) {
            state.productOrderData = data
        },
        SET_ORDERDATABYID(state,data){
            state.orderDataById = data
        },
        SET_ORDER_TAG(state,data){
            state.orderData_Tag = data
        },
    },
    actions: {
        //获取订单信息
        async getProductOrderVuex({ commit }, param) {
            let res = await get('/order/pageQuery', param)
            // console.log(res.data.data.list)
            commit('SET_PRODUCTORDER', res.data.data.list)
        },
        // 按id查询订单信息
        async getOrderDataByIdVuex({ commit }, param) {
            let res = await get('/order/findById', param)
            // console.log(res.data.data)
            commit('SET_ORDERDATABYID', res.data.data)
        },
        //导航栏全部专用订单信息
        async getOrder_Tag({ commit }, param){
            let res = await get('/order/pageQuery', param)
            // console.log(res.data.data.orderLines)
            commit('SET_ORDER_TAG', res.data.data.list)
        },

        // 支付接口
        async payOrderVuex({ commit }, param){
            let res = await get('/app/order/pay', param)
            // console.log(res.data.status)
            return res.data.status
        }
    }
}















